<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>6.270 - JoyOS: buttons.h File Reference</title>
	<link href="main.css" media="screen" rel="Stylesheet" type="text/css"/>
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>  
<body>
	<div id="header">
		<div id="headerb">
		<div id="headtext">
			<span class="titletext">AUTONOMOUS ROBOT DESIGN COMPETITION</span>
			6.270
		</div>
		<div class="mainmenu">
			<a href="http://web.mit.edu/6.270/www">Home</a>
		 	&bull;
			<a href="http://web.mit.edu/6.270/www/about/">About</a> 
		 	&bull;
			<a href="http://web.mit.edu/6.270/www/sponsors/">Sponsors</a>
		 	&bull;
			<a href="http://web.mit.edu/6.270/www/contests/">Past Contests</a> 
		 	&bull;
			<a href="http://web.mit.edu/6.270/www/contestants/">Contestant Information</a>
		</div>
	</div>
	</div>

<div class="maincontent">
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>buttons.h File Reference</h1>User Input/Output - buttons, frob, beeper and battery. <a href="#_details">More...</a>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#d4809fbeccf2decd0d1478c205cf5cd2">FROB_BITS</a>&nbsp;&nbsp;&nbsp;(10)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#5268253240b87a99327d275fac7c5b43">FROB_MIN</a>&nbsp;&nbsp;&nbsp;(0)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#4b2a449d53d3c65bced967bbe24822c4">FROB_MAX</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; FROB_BITS)</td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#b4109e40a41ae76245e6e7a6a3d9e256">go_press</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#8fd1f634cc557de332103c85b3f3330c">stop_press</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#6dc9653e8ee6db5a5209528016272fc2">go_click</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#d3674a70730a545f9d8c862fa82e5c3e">stop_click</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">uint16_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#c85be905ada42bc7fc40f52a6a2602e9">frob_read</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">uint16_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#737453dbc8f550fa308df6fb3d831dd3">frob_read_range</a> (uint16_t min, uint16_t max)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">uint16_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#e818cbc92f83004180cf18185eaea04a">read_battery</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="buttons_8h.html#ccde2188d84e94505dcf44c1fbd4f9ce">beep</a> (uint16_t freq, uint16_t duration)</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This file contains various functions needed for the pushbuttons, frobknob, and beeper. It also allows the user to read the battery voltage. <hr><h2>Define Documentation</h2>
<a class="anchor" name="d4809fbeccf2decd0d1478c205cf5cd2"></a><!-- doxytag: member="buttons.h::FROB_BITS" ref="d4809fbeccf2decd0d1478c205cf5cd2" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define FROB_BITS&nbsp;&nbsp;&nbsp;(10)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Bits of precision for the frob knob. 
</div>
</div><p>
<a class="anchor" name="4b2a449d53d3c65bced967bbe24822c4"></a><!-- doxytag: member="buttons.h::FROB_MAX" ref="4b2a449d53d3c65bced967bbe24822c4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define FROB_MAX&nbsp;&nbsp;&nbsp;(1 &lt;&lt; FROB_BITS)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Max value of frob knob. 
</div>
</div><p>
<a class="anchor" name="5268253240b87a99327d275fac7c5b43"></a><!-- doxytag: member="buttons.h::FROB_MIN" ref="5268253240b87a99327d275fac7c5b43" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define FROB_MIN&nbsp;&nbsp;&nbsp;(0)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Min value of frob knob. 
</div>
</div><p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ccde2188d84e94505dcf44c1fbd4f9ce"></a><!-- doxytag: member="buttons.h::beep" ref="ccde2188d84e94505dcf44c1fbd4f9ce" args="(uint16_t freq, uint16_t duration)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void beep           </td>
          <td>(</td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>freq</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>duration</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Beep at a given frequency for a given duration.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>freq</em>&nbsp;</td><td>Frequency to beep </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>duration</em>&nbsp;</td><td>Duration of beep </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="c85be905ada42bc7fc40f52a6a2602e9"></a><!-- doxytag: member="buttons.h::frob_read" ref="c85be905ada42bc7fc40f52a6a2602e9" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t frob_read           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read a value from the Frob knob. <dl class="return" compact><dt><b>Returns:</b></dt><dd>The position of the frob knob (value 0 to 1023). </dd></dl>

</div>
</div><p>
<a class="anchor" name="737453dbc8f550fa308df6fb3d831dd3"></a><!-- doxytag: member="buttons.h::frob_read_range" ref="737453dbc8f550fa308df6fb3d831dd3" args="(uint16_t min, uint16_t max)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t frob_read_range           </td>
          <td>(</td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>min</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>max</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read the from the frob and scale into the range min&lt;=frob&lt;=max <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>min</em>&nbsp;</td><td>minimum scaled value </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>max</em>&nbsp;</td><td>maximum scaled value </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>return the scaled position of the frob </dd></dl>

</div>
</div><p>
<a class="anchor" name="6dc9653e8ee6db5a5209528016272fc2"></a><!-- doxytag: member="buttons.h::go_click" ref="6dc9653e8ee6db5a5209528016272fc2" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void go_click           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Wait for the user to click the 'Go' button. This will loop until the 'Go' button is pressed and released. 
</div>
</div><p>
<a class="anchor" name="b4109e40a41ae76245e6e7a6a3d9e256"></a><!-- doxytag: member="buttons.h::go_press" ref="b4109e40a41ae76245e6e7a6a3d9e256" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t go_press           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Check if the 'Go' button is pressed. <dl class="return" compact><dt><b>Returns:</b></dt><dd>true if go is pressed. </dd></dl>

</div>
</div><p>
<a class="anchor" name="e818cbc92f83004180cf18185eaea04a"></a><!-- doxytag: member="buttons.h::read_battery" ref="e818cbc92f83004180cf18185eaea04a" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t read_battery           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read the battery voltage. Returns a value in decivolts. @ return The battery voltage in decivolts. 
</div>
</div><p>
<a class="anchor" name="d3674a70730a545f9d8c862fa82e5c3e"></a><!-- doxytag: member="buttons.h::stop_click" ref="d3674a70730a545f9d8c862fa82e5c3e" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void stop_click           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Wait for the user to click the 'Stop' button. This will loop until the 'Stop' button is pressed and released. 
</div>
</div><p>
<a class="anchor" name="8fd1f634cc557de332103c85b3f3330c"></a><!-- doxytag: member="buttons.h::stop_press" ref="8fd1f634cc557de332103c85b3f3330c" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t stop_press           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Check if the 'Stop' button is pressed. <dl class="return" compact><dt><b>Returns:</b></dt><dd>true if stop is pressed. </dd></dl>

</div>
</div><p>
</div>
</div>
<div class="maincontent">
	<div class="footer centre">
		<hr>
		Generated on Sun Jan 18 22:59:34 2009 by&nbsp;<a href="http://www.doxygen.org/index.html">Doxygen</a> 1.5.6<br/>
		6.270 Staff, 2008 | 
		<a href="mailto:6.270-organizers@mit.edu">Contact Us</a> | 
		<a href="http://web.mit.edu">MIT</a>
	</div>
</div>
</body>
</html>
